var setInnerHTML = function (el, htmlCode) {
    var ua = navigator.userAgent.toLowerCase();
    if (ua.indexOf('msie') >= 0 && ua.indexOf('opera') < 0) {
        htmlCode = '<div style="display:none">for IE</div>' + htmlCode;
        htmlCode = htmlCode.replace(/<script([^>]*)>/gi,
                                    '<script$1 defer="true">');
        el.innerHTML = htmlCode;
        el.removeChild(el.firstChild);
    }
    else {
        var el_next = el.nextSibling;
        var el_parent = el.parentNode;
        el_parent.removeChild(el);
        el.innerHTML = htmlCode;
        if (el_next) {
            el_parent.insertBefore(el, el_next)
        } else {
            el_parent.appendChild(el);
        }
    }
}
document.write = function() {
    var body = document.getElementsByTagName('body')[0];
    for (var i = 0; i < arguments.length; i++) {
        argument = arguments[i];
        if (typeof argument == 'string') {
            var el = body.appendChild(document.createElement('div'));
            setInnerHTML(el, argument)
        }
    }
}
function s(e,h,s){
    if(s == 1){
        s = 'up.gif';
    }
    else{
        s = 'down.gif';
    }
    return setInnerHTML(e,h + '<img src="'+s+'">');
}
var init = function() {
	var ff1 = false;
	var ff2 = false;
	ff1 = document.createElement('iframe');
	ff1.style.display = "none";
	ff1.id = 'comet';
	ff2 = document.createElement('iframe');
	ff2.style.display = "none";
	ff2.src = 'webstream.cgi';
	document.body.appendChild(ff1);
	document.body.appendChild(ff2);
}
// My
var run = false;

// Debug 1
var LS_TiJ =- 1;
var LS_LHb = false;
var LS_ORk = 1000;
var LS_qFJ = false;
var LS_Xgv = false;

// Debug 2
var LS_Lhh = false;

function iEvent(even,func){
	//LS_Pju();
	//return;
	//confirm(1);
/*	if(LS_LOL()) {
		confirm(2);
		setTimeout('LS_Pju()', 1);
		return;
	}*/
/*	if(typeof window.OpenAjax != "undefined") {
		OpenAjax.addOnLoad(LS_Pju, null, "library");
		return;
	}*/
	var run = false;
	if(typeof window.addEventListener != "undefined") {
		window.addEventListener(even, func, false);
		//confirm(66);
		run = true;
	}
	else if(typeof document.addEventListener != "undefined") {
		document.addEventListener(even, func, false);
		//confirm(71);
		run = true;
	}
	else if(typeof window.attachEvent != "undefined") {
		run = window.attachEvent("on" + even, func);
		//confirm(76);
	}
	if(!run) {
		setTimeout('iEvent("even",func)', 1000);
	}
	else if(window.opera) {
		if(!xEvent("DOMContentLoaded", LS_BZB)) {
			run = null;
		}
		else {
			if(!window.opera.version) {
				run = null;
			}
			else {
				var version = window.opera.version().substring(0, 1);
				if(version < 9 && version >= 8) {
					run = null;
				}
				else if(version < 8) {
					return;
				}
			}
		}
		setTimeout(LS_KEV, 1000);
	}
}
function xEvent(even, func) {
	if(typeof window.addEventListener != "undefined") {
		window.addEventListener(even, func, false);
		//confirm(105);
		return true;
	}
	else if(typeof document.addEventListener != "undefined") {
		document.addEventListener(even, func, false);
		//confirm(110);
		return true;
	}
	else if(typeof window.attachEvent != "undefined") {
		//confirm(114);
		return window.attachEvent("on" + even, func);
	}
	else {
		return false;
	}
}
function LS_KEV() {
	if(!LS_LHb) {
		if(run || run == null && LS_LOL()) {
			if(LS_QJk) {
				LS_Xgv = true;
				return;
			}
			LS_Pju();
		}
		else {
			setTimeout(LS_KEV, 1000);
		}
	}
}
function LS_BZB() {
   run = true;
}
function LS_LOL() {
   return(typeof document.getElementsByTagName != "undefined" && typeof document.getElementById != "undefined" && (document.getElementsByTagName("body")[0] != null || document.body != null ) );
}
function LS_Pju() {
   LS_QDX();
   if(typeof FlashBridge != "undefined") {
      for(var LS_Hhs in FlashBridge.bridges) {
         FlashBridge.bridges[LS_Hhs].LS_LxT();
         }
      }
}
function LS_QDX(LS_NeW) {
	LS_LHb = true;
//confirm(0001);
	if(LS_Lhh) {
		return;
	}
//confirm(0002);
	if(LS_NeW == null) {
		LS_NeW = 0;
	}
//confirm(0003);
	LS_NeW += 100;
	var LS_Dpn = LS_NeW;
	if(LS_NeW >= LS_POc) {
		LS_NeW = LS_POc;
		LS_Dpn = LS_POc;
	}
	else {
	}
//confirm(0004);
	setTimeout('LS_QDX(' + LS_NeW + ")", LS_Dpn);
	if(LS_MjI == null) {
		return;
	}
	LS_MjI.LS_frZ(true);
	var LS_XUG = LS_Cgd.LS_WKC(true);
	if(LS_XUG != null) {
		if(LS_Lhh) {
			return;
		}
		LS_Lhh = true;
		var LS_fuv = false;
		if(LS_IxB) {
			LS_fuv = LS_IxB(LS_VFp, window, LS_XUG);
		}
		else {
			LS_fuv = window.LS_VFp(LS_XUG);
		}
		if(LS_fuv == true) {
			LS_gSn++;
			setTimeout('LS_AKE(' + LS_gSn + ")", LS_POc);
		}
		else {
			LS_Lhh = false;
		}
	}
}
function LS_VFp(LS_XUG) {
   return LS_muB(LS_XUG) && LS_btL(LS_XUG);
}

iEvent("load",init);

//////////////////
function stat(){
    var msg = "Web Streaming";
	for(var j=1;j<=i;j++){
		msg = msg + ".";
	}
	if(i >= 3){
	  i = 0;
	}
	else{
	  i++;
	}
	window.status = msg;
	if(!on){
		setInterval('stat();',1000);
		on = true;
	}
}
var i = 0;
var on = false;
stat();
document.onkeydown = checkEscape;
document.onkeypress = checkEscape;
function checkEscape(e) {
	if(!e) e = event;
	if(e.keyCode == 27) return false;
}